#include <iostream>

using std::cout;
using std::endl;

class NonCpyable
{
public:
    NonCpyable()
    {

    }

    ~NonCpyable()
    {

    }
private:
    NonCpyable(const NonCpyable &rhs);
    NonCpyable &operator=(const NonCpyable &rhs);
};

class Example
: NonCpyable
{
public:
    Example();
    //1、将拷贝构造函数与赋值运算符函数设置为私有的
/* private: */
/*     Example(const Example &rhs); */
/*     Example &operator=(const Example &rhs); */

    //2、将拷贝构造函数与赋值运算符函数=delete
    /* Example(const Example &rhs) = delete; */
    /* Example &operator=(const Example &rhs) = delete; */

};

void test()
{
    Example e1;

    Example e2 = e1;//拷贝构造函数,error

    Example e3;

    e3 = e1;//赋值运算符函数,error
}

int main(int argc, char **argv)
{
    test();
    return 0;
}

